home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap16 / dun16_6.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  1005 b   |  31 lines

  1. <HTML>
  2.  
  3. <HEAD>
  4.  
  5.   <TITLE>Handling mouseOver and mouseOut Events</TITLE>
  6.  
  7.  
  8.  
  9.   <SCRIPT>
  10.  
  11.     function highlight(callingElement)
  12.  
  13.     {
  14.  
  15.       if (!callingElement.contains(event.fromElement))
  16.  
  17.         callingElement.style.backgroundColor = "yellow";
  18.  
  19.     }
  20.  
  21.  
  22.  
  23.     function unhighlight(callingElement)
  24.  
  25.     {
  26.  
  27.       if (!callingElement.contains(event.toElement))
  28.  
  29.         callingElement.style.backgroundColor = "white";
  30.  
  31.     }
  32.  
  33.   </SCRIPT>
  34.  
  35. </HEAD>
  36.  
  37.  
  38.  
  39. <BODY BGCOLOR=white>
  40.  
  41. <P ID=text onMouseOver="highlight(this);" onMouseOut="unhighlight(this);">
  42.  
  43.   When the cursor moves from normal text within a paragraph to
  44.  
  45.   <B>bold text</B>, a <TT>mouseOut</TT> event is generated by the
  46.  
  47.   <TT>P</TT> element and a <TT>mouseOver</TT> event is generated by
  48.  
  49.   the <TT>B</TT> element. This causes the paragraph highlighting to
  50.  
  51.   blink. The cursor, however, has not moved out of the boundaries
  52.  
  53.   of the <TT>P</TT> element, simply onto one of its child elements.
  54.  
  55. </P>
  56.  
  57. </BODY>
  58.  
  59. </HTML>
  60.  
  61.